package org.giovanolli.mumi.entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * The Class SpecialistFee.
 */
@Entity
@Table(name = "specialist_fee")
public class SpecialistFee extends IdentificableEntity {

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = -1816668563040233277L;

	/** The description. */
	@ManyToOne
	@JoinColumn(name = "attention_type_id")
	private AttentionType attentionType;

	/** The specialist. */
	@ManyToOne
	@JoinColumn(name = "specialist_id")
	private Specialist specialist;

	/** The amount. */
	@Column(name = "amount")
	private Double amount;

	/** The observation. */
	@Column(name = "observation")
	private String observation;

	/** The attention type mode. */
	@Enumerated(EnumType.STRING)
	@Column(name = "attention_type_mode")
	private AttentionTypeMode attentionTypeMode;

	/**
	 * Gets the amount.
	 * 
	 * @return the amount
	 */
	public Double getAmount() {
		return amount;
	}

	/**
	 * Gets the attention type.
	 * 
	 * @return the attention type
	 */
	public AttentionType getAttentionType() {
		return attentionType;
	}

	/**
	 * Gets the attention type mode.
	 * 
	 * @return the attention type mode
	 */
	public AttentionTypeMode getAttentionTypeMode() {
		return attentionTypeMode;
	}

	/**
	 * Gets the description.
	 * 
	 * @return the description
	 */
	@Transient
	public String getDescription() {
		if (null == observation || null == attentionType) {
			return "Tarifa comun";
		} else {
			return observation + "( " + attentionType.getName() + " ) $" + amount;
		}
		
	}

	/**
	 * Gets the observation.
	 * 
	 * @return the observation
	 */
	public String getObservation() {
		return observation;
	}

	/**
	 * Gets the specialist.
	 * 
	 * @return the specialist
	 */
	public Specialist getSpecialist() {
		return specialist;
	}

	/**
	 * Sets the amount.
	 * 
	 * @param amount
	 *            the new amount
	 */
	public void setAmount(Double amount) {
		this.amount = amount;
	}

	/**
	 * Sets the attention type.
	 * 
	 * @param attentionType
	 *            the new attention type
	 */
	public void setAttentionType(AttentionType attentionType) {
		this.attentionType = attentionType;
	}

	/**
	 * Sets the attention type mode.
	 * 
	 * @param attentionTypeMode
	 *            the new attention type mode
	 */
	public void setAttentionTypeMode(AttentionTypeMode attentionTypeMode) {
		this.attentionTypeMode = attentionTypeMode;
	}

	/**
	 * Sets the observation.
	 * 
	 * @param observation
	 *            the new observation
	 */
	public void setObservation(String observation) {
		this.observation = observation;
	}

	/**
	 * Sets the specialist.
	 * 
	 * @param specialist
	 *            the new specialist
	 */
	public void setSpecialist(Specialist specialist) {
		this.specialist = specialist;
	}
}
